<div class="layui-card layadmin-header">
    <div class="layui-breadcrumb" lay-filter="breadcrumb">
        <a lay-href="">主页</a>
        <a><cite lay-href="/code/accountHistory/list">二维码列表</cite></a>
        <a><cite>二维码详情</cite></a>
    </div>
</div>
<style>
    .layui-form-label {
        width:15% !important;
        margin-left:1%;
    }
    .layui-input-inline {
        width: 33% !important;
    }
</style>
<div class="layui-fluid">
  <div class="layui-card">
    <div class="layui-tab layui-tab-brief">
        <div class="layui-tab-content">
            <form class="layui-form layui-form-pane" action="">
                <div class="layui-form-item">
                    <label class="layui-form-label">收款人</label>
                    <div class="layui-input-inline">
                        <input type="text" id="collName" disabled="disabled" class="layui-input">
                    </div>
                    <label class="layui-form-label">二维码类型</label>
                    <div class="layui-input-inline">
                        <select name="codeType" id="codeType" disabled="disabled" lay-search="">
                            <option value="1">支付宝</option>
                            <option value="2">微信</option>
                            <option value="3">聚合码</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">状态</label>
                    <div class="layui-input-inline">
                        <input type="text" id="status" disabled="disabled" class="layui-input">
                    </div>
                    <label class="layui-form-label">费率</label>
                    <div class="layui-input-inline">
                        <input type="text" id="rate" disabled="disabled" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">收款三方系统账号</label>
                    <div class="layui-input-inline">
                        <input type="text" id="collThirdAccount" disabled="disabled" class="layui-input">
                    </div>
                    <label class="layui-form-label">收款三方系统ID</label>
                    <div class="layui-input-inline">
                        <input type="text" id="collThirdId" disabled="disabled" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">最小收款金额</label>
                    <div class="layui-input-inline">
                        <input type="text" id="minAmount" disabled="disabled" class="layui-input">
                    </div>
                    <label class="layui-form-label">最大金额</label>
                    <div class="layui-input-inline">
                        <input type="text" id="maxAmount" disabled="disabled" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">总收金额</label>
                    <div class="layui-input-inline">
                        <input type="text" id="totalCollAmount" disabled="disabled" class="layui-input">
                    </div>
                    <label class="layui-form-label">总收次数</label>
                    <div class="layui-input-inline">
                        <input type="text" id="totalCollNum" disabled="disabled" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">成功次数</label>
                    <div class="layui-input-inline">
                        <input type="text" id="sucNum" disabled="disabled" class="layui-input">
                    </div>
                    <label class="layui-form-label">失败次数</label>
                    <div class="layui-input-inline">
                        <input type="text" id="failNum" disabled="disabled" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">每天最大收款金额</label>
                    <div class="layui-input-inline">
                        <input type="text" id="dayMaxAmount" disabled="disabled" class="layui-input">
                    </div>
                    <label class="layui-form-label">每天最大收款次数</label>
                    <div class="layui-input-inline">
                        <input type="text" id="dayMaxNum" disabled="disabled" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">轮询权重</label>
                    <div class="layui-input-inline">
                        <input type="text" id="weight" disabled="disabled" class="layui-input">
                    </div>
                    <label class="layui-form-label">创建时间</label>
                    <div class="layui-input-inline">
                        <input type="text" id="createTime" disabled="disabled" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">备注信息</label>
                    <div class="layui-input-block">
                        <input type="text" id="remark" disabled="disabled" class="layui-input" style="width: 92%">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">二维码图片</label>
                    <div class="layui-input-block">
                        <img id="codePath" src="">
                    </div>
                </div>
            </form>
        </div>
    </div>
  </div>
</div>

<script>
    layui.use(['admin','form'],function(){
        var form = layui.form
        ,$ = layui.$
        ,admin = layui.admin
        ,element = layui.element
        ,layer = layui.layer ;
        // 导航
        element.render('breadcrumb', 'breadcrumb');
        console.log(layui.router());
        var id = layui.router().search.id;
        admin.req({
            type: 'get',
            url: layui.setter.baseUrl + '/code/accountHistory/get',
            data: {
                id : id
            },
            error: function(err){
                layer.alert(JSON.stringify(err.field), {
                    title: '错误提示'
                })
            },
            success: function(res){
                if(res.code == 0){
                    $('#collName').val(res.data.collName);
                    // $('#codeType').val(res.data.codeType == 1 ? "支付宝" : "微信");
                    $('#codeType').val(res.data.codeType);
                    if(res.data.status == -1) {
                        $('#status').val("待审核");
                    }else if(res.data.status == -2) {
                        $('#status').val("审核不通过");
                    }else if(res.data.status == 0) {
                        $('#status').val("停用");
                    }else if(res.data.status == 1) {
                        $('#status').val("使用中");
                    }
                    $('#rate').val(res.data.rate + '%');
                    $('#collThirdAccount').val(res.data.collThirdAccount);
                    $('#collThirdId').val(res.data.collThirdId);
                    $('#minAmount').val(res.data.minAmount);
                    $('#maxAmount').val(res.data.maxAmount);
                    $('#totalCollAmount').val(res.data.totalCollAmount);
                    $('#totalCollNum').val(res.data.totalCollNum);
                    $('#sucNum').val(res.data.sucNum);
                    $('#failNum').val(res.data.failNum);
                    $('#dayMaxAmount').val(res.data.dayMaxAmount);
                    $('#dayMaxNum').val(res.data.dayMaxNum);
                    $('#weight').val(res.data.weight);
                    $('#codePath').attr('src', res.data.codePath);
                    $('#createTime').val(res.data.createTime);
                    $('#remark').val(res.data.remark);
                    form.render();
                }
            }
        })
    })
</script>